<?php
/* @var $this AnalysisController */
//所有购买会员的等级
$memtype = MemType::model()->getMemtype(1);
?>
<tr>
	<td width="22%" class="pro tl">
		<?php echo CHtml::checkBox('id[]','',array('class'=>'chk f_l chkitem','onclick'=>'CheckList("ids[]","id[]")','value'=>$data->zcr_id))?>  
		<div class="c_img c_img50">
			<?php echo CHtml::link(Tool::thumb($data->product->zp_pic,50,50),array('/home/tuan/detail','id'=>$data->zp_id))?>
		</div>
		<p class="title_pro">
			<?php echo CHtml::link(mb_substr($data->zcr_title,0,16,'utf8'),'javascript:')?>
		</p>
	</td>
	<td width="15%"><?php echo date('Y-m-d H:i',$data->zcr_start_time)?></td>
	<td width="15%"><?php echo date('Y-m-d H:i',$data->zcr_end_time)?></td>
	<td width="10%"><?php echo $data->product->zp_inventory?></td>
	<td width="14%">
		<?php
			if($data->zcr_start_time>time()){
				echo "未开始";
			}elseif($data->zcr_end_time<=time()){
				echo "已结束";
			}else{
				if($data->zcr_status==1){
					if($data->product->zp_inventory>0){
						echo "活动进行中";
					}else{
						echo "活动产品已售完";
					}
				}elseif($data->zcr_status==2){
					echo "已关闭";
				}
			}
		?>
	</td>
	<td width="16%" class="operate">
		<div class="box ">
			<a class="c_06c view" href="javascript:" title="">查看</a>
			<?php if(!empty($data->zcr_condition)){?>
			<div class="view_box ">
				<span class="man_bg view_bg"></span>
				<ul class="meetgive_li">
					<?php foreach($data->zcr_condition as $val){?>
					<li><span class="tit"><?php echo array_key_exists($val['condition'],$memtype)?$memtype[$val['condition']]:""?>：</span><span><strong><?php echo $val['value']?></strong>积分</span></li>
					<?php } ?>
				</ul>
			</div>
			<?php }?>
		</div>
		<?php if(!($data->zcr_start_time<time()&&$data->zcr_end_time>time()&&$data->product->zp_inventory>0)) echo CHtml::link(Yii::t('glo','Update'),array('update','id'=>$data->zcr_id),array('class'=>'c_06c'))?>
		<?php if($data->zcr_end_time<time()||$data->zcr_status==2) echo CHtml::link(Yii::t('cmp','Delete'),'javascript:',array('class'=>'c_06c','onclick'=>'return art_del_confirm("'.$this->pre_module_url.'/memTypeDiscount/delete/id/'.$data->zcr_id.'","你确定要删除这条信息吗？")'))?>  
		<?php if($data->zcr_end_time>time()&&$data->zcr_status==1) echo CHtml::link(Yii::t('cmp','Stop'),'javascript:',array('class'=>'c_06c','onclick'=>'return art_del_confirm("'.$this->pre_module_url.'/memTypeDiscount/change/id/'.$data->zcr_id.'","你确定要停止吗？")')) //启用、停止?>
		<?php if($data->zcr_end_time>time()&&$data->zcr_status==2) echo CHtml::link(Yii::t('cmp','Run'),'javascript:',array('class'=>'c_06c','onclick'=>'return art_del_confirm("'.$this->pre_module_url.'/memTypeDiscount/change/id/'.$data->zcr_id.'","你确定要启用吗？")')) //启用、停止?>
	</td>
</tr>
